<?php
/************************************************************************
 Omnitrix - PHP Development Framework
 Copyright (C) 2012-2018 amonest(eastson@outlook.com)

 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation, either version 3 of the License, or
 (at your option) any later version.

 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.

 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.
************************************************************************/

class admin_controller_critical extends omnitrix_controller
{
	public function index_action()
	{
		$message_type = otx_param_string('message_type');
		$message_text = otx_param_string('message_text');
		$return_url = otx_param_string('return_url');

		$error_detail = otx_html_tag_simple('p', empty($message_type) ? $message_text : $this->_('error_' . $message_type), array('class' => 'message'));

		$error_detail .= otx_html_tag_start('ul', array('class' => 'links'));
		$error_detail .= otx_html_tag_simple('li', otx_html_link($this->_('link_dashboard'), array('href' => otx_router_url('index', 'dashboard', 'admin'))));
		if (empty($return_url)) {
			$error_detail .= otx_html_tag_simple('li', otx_html_link($this->_('link_return'), array('onclick' => 'history.go(-1);')));
		} else {
			$error_detail .= otx_html_tag_simple('li', otx_html_link($this->_('link_return'), array('href' => $return_url)));
		}
		$error_detail .= otx_html_tag_end('ul');

		$error_detail .= otx_html_tag_simple('p', $this->_('text_support', OMNITRIX_SUPPORT), array('class' => 'support'));

		$critical_table = otx_html_create_table($this->_('heading_index'));
		$critical_table->set_id('critical');
		$critical_table->set_body_cell($error_detail);

		otx_html_response_title($this->_('heading_index'));
	}
}